﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0912092_BaiTap01_SymbolsReport
{
    public class DemTanSoNhom1KyTu : DemTanSoNhomKyTu
    {                
        protected override void KhoiTaoDanhSachNhomKyTu()
        {
            danhSachNhomKyTu = new List<NhomKyTu>();
            for (int i = 0; i < 26; i++)
            {
                NhomKyTu nkt = new NhomKyTu();
                nkt.ChuoiKyTu = ((char)(65 + i)).ToString();
                danhSachNhomKyTu.Add(nkt);
            }
        }

        protected override void DemTanSoXuatHienCuaNhomKyTu()
        {
            int inputLength = textInput.Length;
            for (int i = 0; i < inputLength; i++)
            {
                int lengthDs=danhSachNhomKyTu.Count;
                for (int j = 0; j < lengthDs; j++)
                {
                    if (danhSachNhomKyTu[j].ChuoiKyTu.ElementAt(0) == textInput.ElementAt(i))
                    {
                        danhSachNhomKyTu[j].TanSo++;
                        break;
                    }
                }
            }
        }

        protected override void HienThiTitle()
        {
            Console.WriteLine("*** TOP 10 NHOM 1 KY TU ***");
        }
    }
}
